<template>
	<view class="contentBox" >
		<view class="publishList" @tap="toNotice(index)" v-for="(item,index) in notice" :key='index'>
		<view class="publishListTitle">{{item.title}}</view>
		<view class="publishListBottom"><text>{{item.publish_time}}</text></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				notice:{}
			};
		},
		onReady() {
			this.getNotice()
		},
		// onNavigationBarButtonTap() {
		// 	uni.navigateTo({
		// 		url:"./notice-details"
		// 	})
		// },
		methods:{
			//获取历史公告
			getNotice(){
				uni.request({
					url:this.confige.webUrl+"/announcement/listAnnouncement",
					header:{
						'X-Token':this.User.token
					},
					data:{
						userId:this.User.userInfo.id,
					},
					success: (res) => {
						console.log(res)
						this.notice = res.data.result[0].list
					}	
				})
			},
			toNotice(index){
				let notice = this.notice[index];
				uni.navigateTo({
					url:"./notice-details?title="+notice.title+"&content="+notice.content+"&time="+notice.publish_time
				})
			},
		}
	}
</script>

<style lang="less" scoped>
page{ background-color: #FFFFFF;}
.contentBox{ width: 94%; margin: auto;}
.publishList{ border-bottom: 1upx solid #bfbfbf; margin-top:15upx;}
.publishListTitle{ overflow: hidden;white-space:nowrap;text-overflow: ellipsis;  font-size: 30upx; }
.publishListBottom{ display: flex;justify-content: space-between; padding: 15upx; font-size: 20upx;
>text:nth-of-type(1){
	  font-size: 25upx;
	   color:#777777;;
}
>text:nth-of-type(2){
	 border-left: 5upx solid #0081FF;
	  padding-left: 15upx;
	  font-size: 25upx;
}}

</style>

